package com.yunji.common.model.params;

import java.io.Serializable;
import java.util.Arrays;

/**
 * @version 1.0
 * @Project: yunji-coffee
 * @Package com.yunji.netty.domain
 * @FileName Protocol.java
 * @Copyright Copyright © 2024 云集互联. All Rights Reserved
 * Company		com
 * @CreateTime 2024-07-29 11:05:43
 * @Description 消息协议
 * 数据包格式 对应的实体bean
 * +——--------——+——-------——+——-------——+——-------——+——-------------------——+
 * |   同步头	|	 帧类	|	帧序号	|	长度		|			数据			|
 * +——--------——+——-------——+——-------——+——-------——+——-------------------——+
 * 2个字节		1个字节		2个字节		2个字节	(根据具体请情况 字节长度)
 * @Modification Author                    History Time			Version				Description
 * ----------------------------------------------------------------------------------
 * HuaAo0803@163.com	2024-03-30 09:34:31		1.0					业务消息体
 * @since JDK 1.8.0_202
 */
public class CabinetProtocol implements Serializable {
    private static final long serialVersionUID = -2035248813458629692L;

    // 请求包头
    private short head;
    // 请求帧类
    private byte cmd;
    // 帧序号ID
    private byte[] messageId;
    // 数据的长度
    private short length;
    // 数据的内容
    private byte[] content;

    public CabinetProtocol() {
    }

    public CabinetProtocol(short head, byte cmd, byte[] messageId, short length, byte[] content) {
        this.head = head;
        this.cmd = cmd;
        this.messageId = messageId;
        this.length = length;
        this.content = content;
    }

    public short getHead() {
        return head;
    }

    public void setHead(short head) {
        this.head = head;
    }

    public byte getCmd() {
        return cmd;
    }

    public void setCmd(byte cmd) {
        this.cmd = cmd;
    }

    public byte[] getMessageId() {
        return messageId;
    }

    public void setMessageId(byte[] messageId) {
        this.messageId = messageId;
    }

    public short getLength() {
        return length;
    }

    public void setLength(short length) {
        this.length = length;
    }

    public byte[] getContent() {
        return content;
    }

    public void setContent(byte[] content) {
        this.content = content;
    }

    @Override
    public String toString() {
        return "CabinetProtocol{" + "head=" + head +
                ", cmd=" + cmd +
                ", messageId=" + Arrays.toString(messageId) +
                ", length=" + length +
                ", content=" + Arrays.toString(content) + '}';
    }
}
